algorithm to find whether a number is even or odd